#ifndef WIDGET_H
#define WIDGET_H
#include <DMainWindow>
#include <QWidget>
#include <DLabel>
#include <DTitlebar>
#include <DStackedWidget>
#include <DPushButton>
#include <DFileDialog>
#include <appimage.h>
#include <tabbutton.h>
#include <DLineEdit>
#include <DWaterProgress>
#include <QMenu>
#include <QAction>
#include <DCheckBox>
#include <QDragEnterEvent>
#include <DComboBox>
#include <QLineEdit>
#include <QSettings>
#include <DSysInfo>

DWIDGET_USE_NAMESPACE

class Widget : public DMainWindow
{
    Q_OBJECT

public:
    Widget(DMainWindow *parent = nullptr);
    ~Widget();
    void open(QString path);
private:
    void initUI();
    void initConnect();
    void uninstall();
    void openFile();
    void openFile(QString path);
    void openIcon();
    void openIcon(QString path);
    void updateTheme();
    void install();
    void dragEnterEvent(QDragEnterEvent *event);
    void dropEvent(QDropEvent *event);


private:
    QWidget *mainwidget=new QWidget; //这个是主要的窗口主体,一切控件都在这个上边
    DStackedWidget *StackWidget=new DStackedWidget;//用于窗口分页
    DFileDialog *fileDialog=new DFileDialog;//用于打开文件
    appimage *appfile=new appimage;//分析appimage文件所用的类
    //分页
    QWidget *page1=new QWidget; //打开文件
    QWidget *page2=new QWidget; //加载
    QWidget *page3=new QWidget; //选择图标
    QWidget *page4=new QWidget; //输入软件名
    QWidget *page5=new QWidget; //最终页面
    QWidget *page6=new QWidget; //UOS开发者模式提示页面

    //页面控件
    DPushButton *btn_OpenFile=new DPushButton;
    DLabel *lb_Title=new DLabel;
    TabButton *tb_Tab=new TabButton;
    DStackedWidget *sw_icon=new DStackedWidget;
    QWidget *icon_page_file=new QWidget;
    QWidget *icon_page_theme=new QWidget;
    DLabel *lb_icon_file=new DLabel;
    DLabel *lb_icon_theme=new DLabel;
    DLineEdit *ed_theme=new DLineEdit;
    DPushButton *btn_OpenIcon=new DPushButton;
    DLabel *lb_tip_file=new DLabel;
    DPushButton *btn_iconToname=new DPushButton;
    DLabel *lb_icon_page4 = new DLabel;
    QLineEdit *ed_appname=new QLineEdit;
    DPushButton *btn_finish=new DPushButton;
    DWaterProgress *m_water2=new DWaterProgress;
    DLabel *lb_Finish=new DLabel;
    DCheckBox *cb_parameter=new DCheckBox;
    DComboBox *cbb_type=new DComboBox;
    DPushButton *btn_back=new DPushButton;
    QAction *action_donation;
    //变量
    QString filePath;//文件路径
    QString iconPath;//图标路径
    QString theIcon;//desktop中的内容
    QString theName;//软件名称
    QString app_path;
    QString desktop_path;
    QString conf_path;
    bool installForAll;//是否安装在根目录
    double dpi ;


    //菜单
    QMenu *menu=new QMenu;
    QMenu *menu_opendir=new QMenu;
    QAction *action_app=new QAction;
    QAction *action_desktop=new QAction;


};

#endif // WIDGET_H
